package com.superquan.selfstudybootmybatis.controller;

import com.superquan.selfstudybootmybatis.entity.common.ResultBean;
import com.superquan.selfstudybootmybatis.service.MailService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 * @author zwq
 * @description 邮件控制层
 * @date 2022/3/29
 * 参考：https://gitee.com/fangjun0624/spring-sendMail/tree/master
 */
@RestController
@RequestMapping("/sendEmail")
public class EmailController {

    @Resource
    private MailService mailService;

    /**
     * 发送普通文本邮件
     * @return
     */
    @GetMapping("/simpleEmail")
    public ResultBean sendSimpleMail(){
        return mailService.sendSimpleMail();
    }

    /**
     *发送一封带附件的邮件
     * @return
     */
    @GetMapping("/attachmentsEmail")
    public ResultBean sendAttachmentsMail() {
        return mailService.sendAttachmentsMail();
    }

    /**
     * 发送一封嵌入静态资源的邮件
     * @return
     */
    @GetMapping("/inlineEmail")
    public ResultBean sendInlineMail() {
        return mailService.sendInlineMail();
    }

    /**
     * 发送一封模板邮件
     * @return
     */
    @GetMapping("/templateEmail")
    public ResultBean sendTemplateMail() {
        return mailService.sendTemplateMail();
    }
}
